package cn.iocoder.yudao.module.crm.dal.mysql.fuelingrecord;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.crm.dal.dataobject.fuelingrecord.FuelingRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.crm.controller.admin.fuelingrecord.vo.*;

/**
 * 加油记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface FuelingRecordMapper extends BaseMapperX<FuelingRecordDO> {

    default PageResult<FuelingRecordDO> selectPage(FuelingRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FuelingRecordDO>()
                .eqIfPresent(FuelingRecordDO::getGasStation, reqVO.getGasStation())
                .eqIfPresent(FuelingRecordDO::getLicensePlate, reqVO.getLicensePlate())
                .betweenIfPresent(FuelingRecordDO::getFuelingTime, reqVO.getFuelingTime())
                .eqIfPresent(FuelingRecordDO::getPaymentMethod, reqVO.getPaymentMethod())
                .eqIfPresent(FuelingRecordDO::getFuelingMachineNo, reqVO.getFuelingMachineNo())
                .eqIfPresent(FuelingRecordDO::getUnitPrice, reqVO.getUnitPrice())
                .eqIfPresent(FuelingRecordDO::getFuelingVolume, reqVO.getFuelingVolume())
                .eqIfPresent(FuelingRecordDO::getLicensePlatePhoto, reqVO.getLicensePlatePhoto())
                .eqIfPresent(FuelingRecordDO::getFuelingPhotos, reqVO.getFuelingPhotos())
                .eqIfPresent(FuelingRecordDO::getTotalPrice, reqVO.getTotalPrice())
                .betweenIfPresent(FuelingRecordDO::getSubmitTime, reqVO.getSubmitTime())
                .eqIfPresent(FuelingRecordDO::getSubmitBy, reqVO.getSubmitBy())
                .betweenIfPresent(FuelingRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FuelingRecordDO::getId));
    }

}